<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PaymentController;
use App\Http\Controllers\API\EditorController;
use Filament\Facades\Filament;


Route::post('alipay-callback', [PaymentController::class, 'alipay_callback'])->name('alipay.callback');

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:sanctum');

Route::get('/component/{id}', [EditorController::class, 'show'])->name('component.show');

Route::post('/save-project', [EditorController::class, 'saveComponentProject'])->middleware('auth:sanctum')->name('project.save');

Route::get('/test-auth', function () {
    return response()->json([
        'authenticated' => Filament::auth()->check(),
        'user' => Filament::auth()->user(),
    ]);
});
